package org.zffc.common.util;



import java.util.*;

/**
 * 安全对象处理类
 */
public class Safes {
    private Safes() {
    }

    public static <T> List<T> of(List<T> list) {
        return Optional.ofNullable(list).orElse(new ArrayList<>());
    }

    public static Integer of(Integer param) {
        return Optional.ofNullable(param).orElse(0);
    }

    public static String of(String param) {
        return Optional.ofNullable(param).orElse("");
    }

    public static Long of(Long param) {
        return Optional.ofNullable(param).orElse(0L);
    }

    public static <K, V> Map<K, V> of(Map<K, V> param) {
        return Optional.ofNullable(param).orElse(new HashMap<>());
    }

    public static <T> Set<T> of(Set<T> integers) {
        return Optional.ofNullable(integers).orElse(new HashSet<>());
    }

}
